<?php
class sql{
    public $host;
    public $port;
    public $user;
    public $pass;
    public $dbname;
    public $charset;
    public function __construct($dbinfo = array()){
        $this->host=$dbinfo['host'] ??'localhost';
        $this->port=$dbinfo['port'] ??'3306';
        $this->user=$dbinfo['user'] ??'root';
        $this->pass=$dbinfo['pass'] ??'root';
        $this->dbname=$dbinfo['dbname'] ??'php71';
        $this->charset=$dbinfo['charset'] ??'utf8';
    }
    public function db_init(){
        mysqli_connect($this->host,$this->user,$this->pass,$this->dbname,$this->port);
        if(!$link){
            die (mysqli_connect_error());
        }
    }
}
$s1=new sql;
